import React from 'react'
import Title from '../component/Title'
import ChangeCity from '../component/ChangeCity'
import { useState , useCallback } from 'react'

let Home = () => {
    let [city,setCity] = useState({from:'北京',to:'上海'})
    
    let change = useCallback(()=>{
        setCity({from:city.to,to:city.from})
    },[city])
    return <div>
        <Title title="火车购票"></Title>
        <ChangeCity from={city.from} to={city.to} change={change}></ChangeCity>
    </div>
}

export default Home